import { requestNew } from '@/utils/request'
import request from '@/utils/request'
// 绑定银行卡
export async function bindBankCard(params) {
  const res = await request({
    url: '/commission/v1/open/balanceWithdraw/bindBankCard',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}
// 获取openid
export async function openid(params) {
  const res = await request({
    url: '/get-mini-program-openid',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    params: params || {}
  })
  return res
}
// 绑定修改微信（云支付）
export async function bindWechatWithdraw(params) {
  const res = await request({
    url: '/commission/v1/open/balanceWithdraw/bindWechatWithdraw',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    params: params || {}
  })
  return res
}
// 解除微信绑定（云账户）
export async function unbindWechatWithdraw(params) {
  const res = await requestNew({
    url: '/commission/v1/open/balanceWithdraw/unbindWechatWithdraw',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    params: params || {}
  })
  return res
}
// 绑定修改支付宝（云支付）
export async function bindAlipayWithdraw(params) {
  const res = await requestNew({
    url: '/commission/v1/open/balanceWithdraw/bindAlipayWithdraw',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    params: params || {}
  })
  return res
}
// 保存小程序openid
export async function wechatOfficialAccountOpenId(params) {
  const res = await request({
    url: '/commission/wechat-official-account-openId/get',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    params: params || {}
  })
  return res
}
// 获取用户提现数据
export async function getWithdrawData(params) {
  const res = await request({
    url: '/my/real-name-v2/auth',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    params: params || {}
  })
  return res
}
// 获取云账户提现方式
export async function getBalanceWithdrawChannel(params) {
  const res = await requestNew({
    url: '/commission/v1/open/balanceWithdraw/getBalanceWithdrawChannel',
    method: 'get',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}
// 获取推荐人信息接口
export async function getLevelMy(params) {
  const res = await requestNew({
    url: '/customer/v1/open/user/level/my',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}

// 我的页面我的收益
export async function getUserEarningMyPromotion(params) {
  const res = await requestNew({
    url: '/commission/v2/open/UserCommission/getUserEarningMyPromotion',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}

// 我的收益明细-碧选收益
export async function getUserEarning(params) {
  const res = await requestNew({
    url: '/commission/v2/open/UserCommission/getUserEarning',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}

// 我的收益本月
export async function getUserCommissionListCurrentMonth(params) {
  const res = await requestNew({
    url: '/commission/v1/open/UserCommission/getUserCommissionListCurrentMonth',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}

// 我的收益-发放账单
export async function getUserWithdrawList(params) {
  const res = await requestNew({
    url: '/commission/v1/open/UserWithdraw/getUserWithdrawList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}
// 【新】我的收益-发放账单明细
export async function getBillDetails(params) {
  const res = await requestNew({
    url: '/commission/v1/open/UserWithdraw/getUserWithdrawDetail',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 累计返利-待确认已确认明细
export async function listUserUnWithdrawCommission(params) {
  const res = await requestNew({
    url: '/commission/v1/open/UserCommission/listUserUnWithdrawCommission',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 我的收益明细-箱起返利
export async function getUserSummaryInfo(params) {
  const res = await requestNew({
    url: '/bonus/v1/open/UserBoxing/stock/getUserSummaryInfo',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 箱起返利-明细
export async function getUserBoxing(params) {
  const res = await requestNew({
    url: '/bonus/v1/open/UserBoxing/stock/getUserBoxing',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
// 碧划算返利
export async function getBihsCommission(params) {
  const res = await requestNew({
    url: '/commission/v2/open/bihs/commission-account/get',
    method: 'get',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 个人中心我的返利-碧划算金额
export async function getBihsTotal(params) {
  const res = await requestNew({
    url: '/commission/v1/open/bihs/commission-record/prepare/total',
    method: 'get',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 新增我的碧粉数量统计接口
export async function getBxFans(params) {
  const res = await requestNew({
    url: '/customer/v2/open/user/level/my/bxfans/statistics',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 新增我的碧粉列表接口
export async function getBxFansList(params) {
  const res = await requestNew({
    url: '/customer/v1/open/user/level/my/bxfans/list',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 碧划算返利，今日昨日本月上月
export async function getPrepareList(params) {
  const res = await requestNew({
    url: '/commission/v1/open/bihs/commission-record/prepare/list',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
// 碧划算返利，返利结算明细
export async function getSettleDetails(params) {
  const res = await requestNew({
    url: '/commission/v1/open/bihs/commission-record/search',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
// 碧划算返利，提现明细
export async function getTakeRecord(params) {
  const res = await requestNew({
    url: '/commission/v1/open/bihs/commission-take-record/search',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 派送福利 列表
export async function getHundredActiveList(params) {
  const res = await request({
    url: '/earning/box/activation',
    method: 'post',
    data: params || {}
  })
  return res
}

// 派送福利 激活
export async function getActivePermission(params) {
  const res = await request({
    url: '/earning/box/activation/confirm',
    method: 'post',
    data: params || {}
  })
  return res
}

// 派送福利 注销
export async function destoryActive(params) {
  const res = await request({
    url: '/earning/box/activation/cancel',
    method: 'post',
    data: params || {}
  })
  return res
}

// 派送福利 获取验证码
export async function getVerifyCode(params) {
  const res = await request({
    url: `/sms/send`,
    method: 'post',
    data: params || {}
  })
  return res
}

// 派送福利 修改手机号
export async function updateMobile(params) {
  const res = await request({
    url: `/earning/box/activation/mobile/change`,
    method: 'post',
    data: params || {}
  })
  return res
}

// [new] 我的邀请列表
export async function getMyInvitationListNew(params) {
  const res = await requestNew({
    url: '/customer/v1/open/user/level/my/invite',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 查询用户已购未够礼包数
export async function getUserBuyGiftNum(params) {
  const res = await requestNew({
    url: '/customer/v1/open/user/level/sangift/count',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    apiType: 'commission',
    data: params || {}
  })
  return res
}

// 我的邀请列表详情-总贡献金额
export async function getOrderCommissionStatisticsByUserId(params) {
  const res = await requestNew({
    url: '/commission/v1/open/UserCommission/getOrderCommissionStatisticsByUserId',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 拨打电话号码
export async function getPhoneNumber(params) {
  const res = await request({
    url: `/assistant/virtual/mobile`,
    method: 'post',
    data: params || {}
  })
  return res
}

// 实名认证银行列表接口
export async function certificationBank(params) {
  const res = await request({
    url: '/my/certification/bank',
    method: 'post',
    data: params || {}
  })
  return res
}

// 获取国别码
export async function certificationCountry(params) {
  const res = await request({
    url: '/my/real-name-v2/auth-country',
    method: 'get',
    data: params || {}
  })
  return res
}

// 实名认证查询接口 
export async function certificationQuery(params) {
  const res = await request({
    url: '/my/real-name-v2/auth-info',
    method: 'get',
    data: params || {}
  })
  return res
}

// 实名认证回调接口
export async function afterConfirm(params) {
  const res = await request({
    url: '/my/real-name-v2/auth-submit-confirm',
    method: 'post',
    data: params || {}
  })
  return res
}
// 实名认证提交接口
export async function certificationSave(params) {
  const res = await request({
    url: '/my/real-name-v2/auth-submit',
    method: 'post',
    data: params || {}
  })
  return res
}
// 实名认证修改银行卡号接口
export async function certificationUpdateCard(params) {
  const res = await request({
    url: '/my/real-name/update-bank-card',
    method: 'post',
    data: params || {}
  })
  return res
}

// 实名认证获取短信验证码
export async function certificationGetSendMsg(params) {
  // return {code: 0}
  const res = await request({
    url: '/my/real-name/send-verification-code',
    method: 'post',
    data: params || {}
  })
  return res
}

export async function certificationValidMsg(params) {
  const res = await request({
    url: '/my/real-name/check-verification-code',
    method: 'post',
    data: params || {}
  })
  return res
}
// 碧划算提现获取可提现余额及银行卡相关信息
export async function getWithdrawInfo(params) {
  const res = await requestNew({
    url: '/commission/v1/open/withdraw-info/get',
    method: 'GET',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
// 碧划算提现获取可提现余额及银行卡相关信息
export async function withdrawApply(params) {
  const res = await request({
    url: '/my/commission-withdrawal/apply',
    method: 'post',
    headers: {
      // 'Content-Type': 'application/json',
      showMessage: false
    },
    data: params || {}
  })
  return res
}
// 我的箱起统计信息
export async function getFamilyRewardInfoByUserId(params) {
  const res = await request({
    url: '/bonus/v1/open/UserBoxing/stock/getFamilyRewardInfoByUserId',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
// 我的箱起统计信息
export async function getFamilyRewardInfoByUserIdNew(params) {
  const res = await request({
    url: '/bonus/v1/open/UserBoxing/stock/master-slave/getFamilyRewardInfoByUserId',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 我的箱起一级成员列表
export async function getDirectChildRewardInfoListByUserId(params) {
  const res = await request({
    url: '/bonus/v1/open/UserBoxing/stock/getDirectChildRewardInfoListByUserId',
    method: 'post',
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 订单列表查询
export async function getTradeList(data) {
  const res = await request({
    url: '/commission/v1/open/bihs/trade/search',
    method: 'post',
    data,
    apiType: 'commission',
    headers: {
      'Content-Type': 'application/json'
    }
  })
  return res
}

// 获取支付宝信息
export async function getAlipay(params) {
  const res = await requestNew({
    url: '/bihs/user-relation/alipay/get',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 支付宝提现短信验证码
export async function getAlipySms(params) {
  const res = await requestNew({
    url: '/bihs/user-relation/alipay/sms',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 支付宝提现短信验证码验证
export async function getAlipyCheck(params) {
  const res = await requestNew({
    url: '/bihs/user-relation/alipay/sms/check',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}

// 绑定支付宝
export async function getAlipyUpdate(params) {
  const res = await requestNew({
    url: '/bihs/user-relation/alipay/update',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    data: params || {}
  })
  return res
}
